<?php

namespace app\common\model\banxi\learn;

use app\common\enums\GameTypeEnum;
use app\common\model\common\BaseModel;
use think\model\concern\SoftDelete;

/**
 * 听力答题记录
 */
class LearnFunRecord extends BaseModel
{
    use SoftDelete;

    protected $name = 'banxi_learn_fun_record';

    protected $autoWriteTimestamp = true;

    protected $deleteTime = 'del';

    protected $defaultSoftDelete = 0;

    protected $append = [
        'gameTypeCn'
    ];

    //-----------------------------------------------------------------------------------
    //｜                                   获取器                                       ｜
    //-----------------------------------------------------------------------------------

    public function getGameTypeCnAttr($value, $data): string
    {
        $value = $value ?: ($data['gameType'] ?? '');
        return (new GameTypeEnum())->getDescription($value) ?? '';
    }

    //-----------------------------------------------------------------------------------
    //｜                                   处理方法                                       ｜
    //-----------------------------------------------------------------------------------


    //-----------------------------------------------------------------------------------
    //｜                                   模型关联                                       ｜
    //-----------------------------------------------------------------------------------
}